package fr.umlv.ig.metroView.confView;

import javax.swing.JScrollPane;
import javax.swing.JTree;

import fr.umlv.ig.adapter.TrainTreeModel;
import fr.umlv.ig.listenerFactory.TrainTreeListenerFactory;
import fr.umlv.ig.model.MetroModelImpl;

public class TreeTrainConfView {

	public static JScrollPane getTreeTrainPanel(final MetroModelImpl model) {
		TrainTreeModel treeModel = new TrainTreeModel(model);
		final JTree jtree = new JTree(treeModel);
		jtree.setRootVisible(false);
		jtree.addTreeSelectionListener(TrainTreeListenerFactory.getSelectionListener(jtree));
		//jtree.addMouseListener(TrainTreeListenerFactory.getMouseAdapter(jtree));	

		jtree.setCellRenderer(TrainTreeListenerFactory.getTreeCellRenderer(treeModel));
		JScrollPane pane = new JScrollPane(jtree);
		return pane;
	}
}
